<?php
session_start();
$method = $_POST['method'];

if($method == 'putOnSession'){
	putOnSession();
}else if ($method == 'getOfSession'){
	getOfSession();
}

function putOnSession(){
	try{
		$_SESSION['login']=true;
		echo 'successful';
	}catch (Exception $e){
		echo 'error';
	}
}

function getOfSession(){
	if(isset($_SESSION['login'])){
		echo 'successful';
	}else{
		echo 'error';
	}
}
?>